package cn.qn.controller;

import cn.qn.dto.ResponseDTO;
import cn.qn.dto.apply.ChargerBuildApplyDTO;
import cn.qn.dto.apply.ChargerBuildApplySendDTO;
import cn.qn.exceptions.BizException;
import cn.qn.service.apply.ChargerBuildApplyService;
import com.alibaba.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: Bryant
 * @date: 2019/5/31
 * @description:
 */
@RestController
@RequestMapping("/charger/apply")
public class ChargerBuildApplyController {

    @Reference(check = false,timeout = 30000)
    private ChargerBuildApplyService chargerBuildApplyService;

    @RequestMapping(value = "/send" ,name="发送建桩申请接口",method = RequestMethod.POST)
    public ResponseDTO send(@RequestBody ChargerBuildApplySendDTO dto){
        try {
            chargerBuildApplyService.saveApply(dto);
            return ResponseDTO.success();
        }catch (BizException e){
            return ResponseDTO.error(e.getMessage());
        }
    }
}
